<script setup>
import {ref} from "vue";
import {useRouter} from "vue-router";
import axios from "axios";

const username = ref('')
const password = ref('')
const router = useRouter();
const login = async () => {
  try {
    const response = await axios.post("/login", {
      username: username.value,
      password: password.value,
    });
    localStorage.setItem("jwt", response.data.token);
    router.push("/home");
  } catch (error) {
    console.log("登录失败：", error);
  }
}
</script>

<template>

</template>

<style scoped>

</style>